/* ----------------------------- Marlin Toolkit----------------------------*
Authors : Daniel Randle, Alex Bourne
Date Created : Mar 1 2013

File:
	objectwindow.h

Description:
	This file contains the necessary declarations of the ObjectWindow class which is
	the viewport for the Objects in the game that you can select
*---------------------------------------------------------------------------*/
#ifndef OBJECTWINDOW_H
#define OBJECTWINDOW_H

// Includes
#include <qwidget>
#include <global.h>
#include <qmap.h>

// Forward declarations
class QTreeWidget;
class QSplitter;
class QVBoxLayout;
class QTreeWidgetItem;
class QAction;

class NSEngine;

#ifdef DEBUG
class Debug;
#endif

namespace ToolkitGui
{
	class HexTileDialog;

	class ObjectWindow : public QWidget
	{
		Q_OBJECT
	public:
		ObjectWindow(QWidget * parent=NULL, Qt::WindowFlags f = 0);

		void setEngine(NSEngine * eng);
		void update();

		#ifdef DEBUG
		void setDebug(Debug * debug);
		#endif

	signals:
		void activateBuild();

	private slots:

		void onFilterItemChanged(QTreeWidgetItem* current,QTreeWidgetItem* previous);
		void onHexTileAct();
		void onDoubleClick(QTreeWidgetItem * item, int column);


	private:
		void _initObjects();
		void _setupUi();
		void _setupHeaders();
		void _createFilterItems();
		void _fillContextMenus();
		void _setupConnections();
		void _clearTreeWidgets();


		#ifdef DEBUG
		Debug * d;
		#endif

		// Qt objects
		QSplitter * splitter;
		QTreeWidget * filter;
		QVBoxLayout * winLayV;

		// Dialogs
		HexTileDialog * hexTileD;

		// Object Tree Widgets
		QTreeWidget * hexTileList;
		QTreeWidget * staticObjectList;
		QTreeWidget * lightList;

		// Actions
		QAction * hexTileAct;

		//Engine 
		NSEngine * engine;

		QMap<QString,QTreeWidget*> treeWidgetMap;
	};

}

#endif